package org.openems.entity;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class TableEntity extends AbstractEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3166637229141093792L;
	private List<String[]> rowDataList = new ArrayList<String[]>();
	private String[] title;
	
	public String[] getTitle() {
		return title;
	}

	public void setTitle(String[] title) {
		this.title = title;
	}

	public List<String[]> getRowDataList() {
		return rowDataList;
	}

	public void setRowDataList(List<String[]> rowDataList) {
		this.rowDataList = rowDataList;
	}
	
	@Override
	protected TableEntity clone() {
		try {
			List<String[]> list = new ArrayList<String[]>();
			for (String[] d : rowDataList) {
				list.add(Arrays.copyOf(d, d.length));
			}
			TableEntity ret = (TableEntity)super.clone();
			ret.setRowDataList(list);
			return ret;
			
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return null;
	}

	public TableEntity(Key key, String name, boolean persisted) {
		super(key, name, persisted);
		// TODO Auto-generated constructor stub
	}

	@Override
	public String getValueText() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setValueText(String text) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public Entity getClone() {
		return this.clone();
	}

	public int getColumnCount() {
		return this.title.length;
	}
}
